<template>
  <el-button size="mini" style="position: relative;overflow: hidden;" v-bind="$attrs" @click="buttonClick">
    <slot></slot>
    <input type="file" ref="inputFile" style="position: absolute;cursor: pointer; 
    width: 100%;height: 100%;top: 0;left: 0;outline: none;opacity: 0;filter: alpha(opacity=0);" @change="changeFile" />
  </el-button>
</template>

<script>
export default {

  props: {

  },
  data() {
    return {

    }
  },
  methods: {
    buttonClick(e){
      this.$refs.inputFile.value = "";

    },
    changeFile(e) {
      
      let files = e.target.files // input 本身，从这里获取 files<FileList>
      this.$emit('input', files)

    }
  },
}
</script>

